import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'app_exceptions.dart';

/// 错误处理
class ErrorInterceptor extends Interceptor {
  @override
  Future onError(DioError err){
    // error 统一处理
    AppException appException = AppException.create(err);
    // 提示错误
    debugPrint('DioError===: ${appException.toString()}');

    err.error = appException;
    return super.onError(err);
  }

}